import { Profile } from '@/types/user'

const PROFILE_KEY = 'rabbit-profile'

/**
 * 设置个人信息
 * @param profile 
 */
export const setProfile = (profile: Profile): void => {
	localStorage.setItem(PROFILE_KEY, JSON.stringify(profile))
}

/**
 * 获取个人信息
 * @returns 
 */
export const getProfile = (): Profile => {
	return JSON.parse(localStorage.getItem(PROFILE_KEY) || '{}')
}

/**
 * 移除个人信息
 */
export const removeProfile = (): void => {
	localStorage.removeItem(PROFILE_KEY)
}
